package com.mvc.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.mvc.util.XmlParser;

public class MvcConfigListener implements ServletContextListener {

	public void contextInitialized(ServletContextEvent sce) {
		System.out.println("系统信息开始加载！");
		ServletContext sc = sce.getServletContext();
		String mvc = sc.getInitParameter("mvc-config");
		String realPath = sc.getRealPath("\\");
		sc.setAttribute("mvcConfig", XmlParser.parser(realPath + mvc));
		System.out.println("系统信息加载完毕！");
	}

	public void contextDestroyed(ServletContextEvent sce) {
		System.out.println("系统信息注销！");
	}

}
